
package com.joysuch.wwyt.bp.enums;

public enum SafetyRiskWorkTypes {

    DONG_HUO_0(1, "特级动火作业", "donghuo_0"),
    DONG_HUO_1(2, "一级动火作业", "donghuo_1"),
    DONG_HUO_2(3, "二级动火作业", "donghuo_2"),
    GAO_CHU_0(4, "特级高处作业", "gaochu_0"),
    GAO_CHU_1(5, "一级高处作业", "donghuo_1"),
    GAO_CHU_2(6, "二级高处作业", "donghuo_2"),
    GAO_CHU_3(7, "三级高处作业", "donghuo_3"),
    SHOU_XIAN_KONG_JIAN(8, "受限空间作业", "shouxiangongjian"),
    MANG_BAN_CHOU_DU(9, "盲板抽堵作业", "mangbanchoudu"),
    LIN_SHI_YONG_DIAN(10, "临时用电作业", "linshiyongdian"),
    DIAO_ZHUANG(11, "吊装安全作业", "diaozhuang"),
    DONG_TU(12, "动土安全作业", "dongtu"),
    DUAN_LU(13, "断路安全作业", "duanlu"),

   ;

    private int id;
    private String code;
    private String name;

    private SafetyRiskWorkTypes(int id, String name, String code) {
        this.id = id;
        this.name = name;
        this.code = code;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static SafetyRiskWorkTypes findByName(String name) {
        SafetyRiskWorkTypes[] values = SafetyRiskWorkTypes.values();
        for (SafetyRiskWorkTypes v : values) {
            if (v.getName().equals(name)) {
                return v;
            }
        }
        return null;
    }

    public static SafetyRiskWorkTypes findByCode(String code) {
        SafetyRiskWorkTypes[] values = SafetyRiskWorkTypes.values();
        for (SafetyRiskWorkTypes v : values) {
            if (v.getCode().equals(code)) {
                return v;
            }
        }
        return null;
    }

    public static SafetyRiskWorkTypes findById(Integer level) {
        SafetyRiskWorkTypes[] values = SafetyRiskWorkTypes.values();
        for (SafetyRiskWorkTypes v : values) {
            if (v.getId() == level) {
                return v;
            }
        }
        return null;
    }

    public static String findNameById(Integer level) {
        SafetyRiskWorkTypes[] values = SafetyRiskWorkTypes.values();
        for (SafetyRiskWorkTypes v : values) {
            if (v.getId() == level) {
                return v.getName();
            }
        }
        return null;
    }
}
